%%
conn = cBloomberg;
%%
codes = {'m1801-C-2650';'m1801-P-2650';...
    'm1801-C-2700';'m1801-P-2700';...
    'm1801-C-2750';'m1801-P-2750';...
    'm1801-C-2800';'m1801-P-2800';...
    'm1801-C-2850';'m1801-P-2850';...
    'm1805-C-2650';'m1805-P-2650';...
    'm1805-C-2700';'m1805-P-2700';...
    'm1805-C-2750';'m1805-P-2750';...
    'm1805-C-2800';'m1805-P-2800';...
    'm1805-C-2850';'m1805-P-2850';...
    'SR801C6000';'SR801P6000';...
    'SR801C6100';'SR801P6100';...
    'SR801C6200';'SR801P6200';...
    'SR801C6300';'SR801P6300';...
    'SR801C6400';'SR801P6400';...
    'SR805C5900';'SR805P5900';...
    'SR805C6000';'SR805P6000';...
    'SR805C6100';'SR805P6100';...
    'SR805C6200';'SR805P6200';...
    'SR805C6300';'SR805P6300';};
opts = cell(size(codes,1),1);
for i = 1:size(codes,1)
    opts{i} = cOption(codes{i,1});
    opts{i}.init(conn);
end

fut1 = cFutures('m1801');fut1.init(conn);
fut2 = cFutures('m1805');fut2.init(conn);
fut3 = cFutures('SR801');fut3.init(conn);
fut4 = cFutures('SR805');fut4.init(conn);

%%
qms_demo = cQMS;
qms_demo.setdatasource('bloomberg');
for i = 1:size(codes,1)
    qms_demo.registerinstrument(opts{i});
end
qms_demo.watcher_.calcgreeks = false;

%%
strat_demo = cStratOptMultiCPArb;
for i = 1:size(codes,1)
    strat_demo.registerinstrument(opts{i});
end

% for i = 1:size(codes,1)
%     strat_demo.removeinstrument(opts{i});
% end

%%
qms_demo.refresh;
quotes = qms_demo.getquote;

%%
signals = strat_demo.gensignal({},quotes);